/**
 * @type {Date}
 *
 * @properties={typeid:35,uuid:"F3A81E4C-65B1-4367-9B2F-296294910F53",variableType:93}
 */
var f_hasta = null;

/**
 * @type {Date}
 *
 * @properties={typeid:35,uuid:"C1DCD98F-E78B-4A6F-86E6-A9A53F33667D",variableType:93}
 */
var f_desde = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"92061401-A98C-41EC-BABC-E1882DEF6584",variableType:4}
 */
var f_deposito = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"C44E2074-CB74-4930-9163-9782ACB41191",variableType:4}
 */
var f_cliente = null;

/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"3DBC0110-491A-4C4D-9380-C442F4B1BCDC"}
 */
var f_cod_producto = null;

/**
 * @type {String}
 *
 * @properties={typeid:35,uuid:"998D4E0A-EDF7-474E-B20D-C20D6A9F8890"}
 */
var f_descripcion = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"3B114B08-EC5E-4E03-9BC0-E7640E86A9BA",variableType:4}
 */
var f_hubo_art = 0;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"611155C1-31DC-40C4-883E-51D412BB2AAA",variableType:4}
 */
var f_inactivo = 0;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"4C94E6C4-5D6A-4A33-A484-2858114F7E57",variableType:4}
 */
var f_proveedor = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"23784FF3-0355-402C-AE08-453BF9A8B7B8",variableType:4}
 */
var f_tipo = null;

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"6C1E6D33-B610-4E26-BB0E-69B6A6F9692F"}
 */
function Ira_detalle(event) 
{
	//forms.hist_stock_det.controller.loadRecords(hist_stock_id) 
	globals.mostrarForm("hist_stock_det");
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"98D4ED64-C58D-4BCF-9DBB-4DD4F00B3A0A"}
 */
function iniciar(firstShow, event) 
{
	if (firstShow)
	{
		foundset.loadAllRecords();
		databaseManager.setAutoSave(true);
		f_cliente = null
		buscar();
	}
}

/**
 * @properties={typeid:24,uuid:"C0DB5846-B4C8-4E45-AD4F-20FC676A1199"}
 * @AllowToRunInFind
 */
function buscar() 
	{
	foundset.loadAllRecords();  
	if(controller.find()==false)
	{
		globals.gMensaje = 'No encontró productos (find)';
		globals.DIALOGS.showInfoDialog('Estadisticas Stock',  globals.gMensaje,  "OK") //  30/12/2013
		return false; 
	}
	if (f_descripcion !=null)
		hist_stock_to_productos.descripcion = '#%' + f_descripcion + '%';
	
	if (f_tipo != null)
		tipo=f_tipo;
	
	/*
	if(f_inactivo!=1)  // solo activos
		inactivo=0;
	else 
		inactivo=1;    // solo inactivos 
	*/
	
	if (f_proveedor != null)
		proveedor_id = f_proveedor;
	
	
	if (f_cliente != null)
		cliente_id = f_cliente;
	
	if(controller.search() == 0)
	{
		f_hubo_art = 0;
		globals.gMensaje = 'No encontró producto en ese rango'
		globals.DIALOGS.showInfoDialog('Estadisticas Stock',  globals.gMensaje,  "OK") //  30/12/2013
		return false;
	} 
	else
		f_hubo_art = 1;
	
	elements.boton_detalle.requestFocus();  // queda parado en el primero que encontró
	return true;
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"4AE81B92-0BF3-403F-9EEB-A3FAA1016FDD"}
 */
function todos(event) 
{
	f_cod_producto = null;
	f_descripcion = null;
	f_tipo = null;
	f_proveedor = null;
	f_cliente = null; 
	if(event.getElementName() =='todos') 
		buscar();
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"93E02470-C973-4E35-A984-54C916CFEBC2"}
 */
function onAction_producto(event) 
{  
	buscar();
 
}

